package chapter18.tankwar;

import javax.swing.*;

/**
 * @Auther: Tx
 * @Date: 2022/5/28 18:14
 */
public class DrawTank extends JFrame {

    private  MyPanel myPanel = null;

    public static void main(String[] args) {
        new tankwar4.DrawTank();
    }

    public DrawTank() {
        myPanel = new MyPanel();
//        将myPanel放入放入Thread并启动
        new Thread(myPanel).start();
//         添加到窗口
        this.add(myPanel);
//         新建窗口
        this.setSize(1000, 750);
//        设置关闭
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//        显示
        this.setVisible(true);
//        监听键盘事件
        this.addKeyListener(myPanel);

    }
}



